import request from '@/utils/request.js'
import type { loginData, loginResponseData, registerData, registerResponseData } from '@/api/type'

// 注册模块
export const registerAPI = (data: registerData) =>
  request.post<any, registerResponseData >('/api/reg', data)
// 登录模块
export const loginAPI = (data: loginData) =>
  request.post<any, loginResponseData>('/api/login',data)

// 获取用户基本信息
export const getUserInfoAPI = () => request.get('/my/userinfo')

// 更新用户基本信息
export const updateUserInfoAPI = (data) => request.put('/my/userinfo', data)

// 更新用户头像
export const updateUserPhotoAPI = (avatar) =>
  request.patch('/my/update/avatar', { avatar })

// 更新用户密码
export const updateUserPasswordAPI = (data) =>
  request.patch('/my/updatepwd', data)
